.w-section.section
  .w-container
    .w-row
      .w-col.w-col-10.w-col-push-1 
        .w-form.card.card-terciary.medium.u-marginbottom-80
          = simple_form_for @project do |f|
            =  hidden_field_tag 'anchor', 'posts'
            = f.simple_fields_for :posts, @project.posts.build do |form|
              = form.label :title, as: :string, class: 'field-label fontweight-semibold'
              = form.input_field :title, as: :string, class: 'w-input text-field positive'

              = form.label :comment, as: :string, class: 'field-label fontweight-semibold'
              = form.input_field :comment_html, class: 'redactor text-field'

              .w-checkbox.w-clearfix.u-marginbottom-30
                = form.check_box :exclusive, class: 'w-checkbox-input'
                = form.label :exclusive, t('.only_to_backers'), class: 'w-form-label fontsize-small'

              .card.card-message.u-radius.u-marginbottom-40
                .fontsize-small= t('.warning')

              .w-row.u-marginbottom-20
                .w-col.w-col-5.w-sub-col.w-col-push-2
                  = form.submit t('.publish'), class: 'btn btn-medium'
                .w-col.w-col-3.w-col-push-2
                  = link_to t('.discard'), 'javascript:location.reload();', class: 'btn btn-medium btn-terciary'
        .fontsize-large.fontweight-semibold.u-marginbottom-40= t('.old_posts')
        - @project.posts.order('created_at DESC').each do |post|
          - if post.persisted?
            .project-news.u-marginbottom-30
              .w-row
                .w-col.w-col-11.w-col-small-11.w-col-tiny-11
                  .fontsize-large.fontweight-semibold= post.title
                .w-col.w-col-1.w-col-small-1.w-col-tiny-1
                  = link_to '', project_post_path(@project, post), class: 'btn btn-small btn-terciary fa fa-lg fa-trash btn-no-border', method: :delete
              .fontsize-small.fontcolor-secondary.u-marginbottom-20= l(post.created_at, format: :posts)
            .divider.u-marginbottom-30
